package javabackground;
import java.io.*;
import java.net.*;

public class Server extends Thread
{
	int port;
    ServerSocket server;
    Socket socket;
    PrintWriter  out = null;
    BufferedReader in = null;
    public Server(int port)
    {
        try
        {
            this. port=port;
            server=new ServerSocket(port);
        }
        catch (Exception e)
        {
            System.out.println(e.toString());
        }
    }
    public void run()
    {
        try
        {
            server=new ServerSocket(6666);
            while(true)
            {
                socket=server.accept();
                Worker slave=new Worker(socket);
                slave.start();
            }

        }
        catch (Exception e)
        {
            System.out.println(e.toString());
        }
        catch (Exception e)
        {
            System.out.println(e.toString());
        }
    }
}
